{include file="public/header" /}
<style>
  .pagelist {padding:10px 0; text-align:center;}
  .pagelist span,.pagelist a{ border-radius:3px; border:1px solid #dfdfdf;display:inline-block; padding:5px 12px;}
  .pagelist a{ margin:0 3px;}
  .pagelist span.current{ background:#09F; color:#FFF; border-color:#09F; margin:0 2px;}
  .pagelist a:hover{background:#09F; color:#FFF; border-color:#09F; }
  .pagelist label{ padding-left:15px; color:#999;}
  .pagelist label b{color:red; font-weight:normal; margin:0 3px;}
</style>
<body>
<div class="layui-tab layui-tab-brief main-tab-container">
    <ul class="layui-tab-title main-tab-title">
      <a href="{:url('article/index_article')}"><li class="layui-this">文章列表</li></a>
      <a href="{:url('article/add_article')}"><li>添加文章</li></a>
      <div class="main-tab-item">文章管理</div>
    </ul>
    <div class="layui-tab-content">
      <div class="layui-tab-item layui-show">
      <form class="layui-form" name="paixu" method="post" onsubmit="return false;">

            <table class="list-table">
              <thead>
                <tr>
                  
                  <th>ID</th>
                  <th>文章标题</th>
                  <th>所属分类</th>
                  <th>创建时间</th>
                  <th>修改时间</th>
                  <th>操作</th>
                </tr>
              </thead>
                <tbody>
                {volist name="artObj" id="vo"}
                  <tr>
                    <td>{$vo.id}</td>
                    <td>{$vo.title}</td>
                    <td>{$vo.cate.name}</td>
                    <td>{$vo['create_time']|strtotime|date='Y-m-d H:i:s',###}</td>
                    <td>{$vo['update_time']|strtotime|date='Y-m-d H:i:s',###}</td>
                    <td style="text-align: center;">
	                      <a href="{:url('edit_article',array('id'=>$vo['id']))}" class="layui-btn layui-btn-small" title="编辑"><i class="layui-icon"></i></a>
	                      <a class="layui-btn layui-btn-small layui-btn-danger del_btn" category-id="1" title="删除" id="{$vo.id}"><i class="layui-icon"></i></a>
                    </td>
                  </tr>
                {/volist}
                </tbody>

            </table>

      </form>
        <p style="float: right;margin-right:20px;">{$artObj->render()}</p>
      </div>
    </div>
</div>
<script type="text/javascript">
$(function(){
        //删除操作
        $(".del_btn").click(function(){
            var $this = $(this)
            var id=$this.attr('id');
            $.ajax({
              url: "{:url('article/del_article')}",
              data: {'id':id},
              type: "POST",
              datatype:"json",
              success: function( result ) {

                  $this.parents('tr').remove();
                  layer.open({
                      title: '信息'
                      ,content: '删除成功！'
                  });
              }
            });
        });
        //状态
        $("#zzz").click(function(){
        $.ajax({
            url: "{:url('article/status')}",
            data: $("form").serialize(),
            type: "POST",
            datatype:"json",
            success: function( result ) {
                layer.open({
                    title: '信息'
                    ,content: '设置成功！'
                });
            }
        });
    });

    });

layui.use(['element', 'layer', 'form'], function(){
  var element = layui.element()
  ,jq = layui.jquery
  ,form = layui.form()
  ,laypage = layui.laypage;

})
</script>
</body>
</html>